Repository navigation
fix(github-backup): shape-validate config, bws output and conversion response in app_setup (#6849) - #8690
Conversation
…response in app_setup (#6849) load_config now validates the config shape the tools index (app.name/events/bitwarden_secret_names with the app_setup names, worker.webhook_path) and raises a field-naming ValueError; app_setup turns that into a clean stderr diagnostic + exit 2 at import for every subcommand. _bws_list/_project_id/bws_get check return codes (reporting the bws failure) and parsed shapes via a shared _bws_json. cmd_convert validates the full conversion response (id/client_id/client_secret/pem/slug) before the first bws_set, so a bad response stores nothing. install-report validates the installations payload before indexing. New tests test_app_setup_shape.py (14) cover the probe cases; full github-backup suite green.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 13 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review New PR for #6849: shape validation for config (validate_config in ghb_common), bws readers (return-code + shape via _bws_json), conversion response validated before any bws_set, and installations payload validated before indexing. Please review head b1c5db7. (Queue worker lane code-c, task 11070.) |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Fixes #6849.
Problem
app_setup.pyparsed every trust-boundary value unguarded: a wrong-shapeconfig.jsoncrashed every subcommand at import (KeyError/TypeErrorfrom the import-timeCFG["app"]["bitwarden_secret_names"]indexing),_project_id/bws_getnever checked the bws return code (a bws failure surfaced as a false "no projects" claim or a rawJSONDecodeError), andcmd_convertstored credentials one at a time from an unvalidated conversion response — a missingpemcrashed after 3 of 4 secrets were already stored, leaving a partial credential set.Fix
ghb_common.load_confignow validates via newvalidate_config(the github-backup(fetch): a valid-JSON but wrong-shape plan/state entry crashes the whole daily fetch — one poison entry in plan.json or state.json wedges every repo, every day #6637 named-problem contract): top-level object,appobject with non-empty stringname,eventslist of strings,bitwarden_secret_namesstring->non-empty-string object containing the five names app_setup stores under, andworker.webhook_pathnon-empty string. Violations raise a field-namingValueError;app_setupcatches it at import and exits 2 with a clean stderr diagnostic for every subcommand._bws_jsonchecks the subprocess return code (reports the bws failure with its stderr excerpt) and parseability;_bws_list,_project_id, andbws_getadditionally validate the parsed shape (list of objects with stringid/key; object with stringvalue).cmd_convertrunsvalidate_conversion(integerid; non-empty stringclient_id/client_secret/pem/slug) before the firstbws_set— a bad response stores nothing.cmd_install_reportrunsvalidate_installations(integerid,account.loginstring) before indexing.Tests
Oracle: the #6849 probe table. New
tests/test_app_setup_shape.py(14 tests): wrong-shape config cases name the field, real-config control passes, import with a wrong-shape config exits 2 with no traceback, bws error-object / non-object-list / failed-call cases report the bws failure or the shape, partial conversion response stores nothing, full conversion stores all four values in order, installations shape validated. Wholeinfra/github-backup/tests/suite green (14 files).Queue task 11070, lane code-c.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.